<?php

class RecipeController extends CController
{
	public $defaultAction='listAll';

	public function actions()
	{
		return array(
            'create'=>'application.controllers.recipe.CreateAction',
            'publish'=>'application.controllers.recipe.PublishAction',
            'delete'=>'application.controllers.recipe.DeleteAction',
            'list'=>'application.controllers.recipe.ListAction',
            'listAll'=>'application.controllers.recipe.ListAllAction',
            'show'=>'application.controllers.recipe.ShowAction',
            'setTitle'=>'application.controllers.recipe.SetTitleAction',
            'setDescription'=>'application.controllers.recipe.SetDescriptionAction',
            'setTip'=>'application.controllers.recipe.SetTipAction',
            'setEffectiveness'=>'application.controllers.recipe.SetEffectivenessAction',
            'setImage'=>'application.controllers.recipe.SetImageAction',
            'deleteImage'=>'application.controllers.recipe.DeleteImageAction',
            'setIngredients'=>'application.controllers.recipe.SetIngredientsAction',
            'appendStep'=>'application.controllers.recipe.AppendStepAction',
            'deleteStep'=>'application.controllers.recipe.DeleteStepAction',
            'forwardStep'=>'application.controllers.recipe.ForwardStepAction',
            'backwardStep'=>'application.controllers.recipe.BackwardStepAction',
		);
	}

	public function filters()
	{
		return array(
			'accessControl',
		);
	}

	public function accessRules()
	{
		return array(
			array('allow',
				'actions'=>array('list','show','listAll'),
				'users'=>array('*'),
			),
			array('allow',
                'actions'=>array('create','publish','delete','setTitle','setDescription','setTip','setEffectiveness','setImage','deleteImage','setIngredients','appendStep','deleteStep','forwardStep','backwardStep'),
				'users'=>array('@'),
			),
			array('deny',
				'users'=>array('*'),
			),
		);
	}
}
